<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Class: ActiveRecord::Reflection::MacroReflection</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Class</strong></td>
          <td class="class-name-in-header">ActiveRecord::Reflection::MacroReflection</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../../../files/vendor/rails/activerecord/lib/active_record/reflection_rb.html">
                vendor/rails/activerecord/lib/active_record/reflection.rb
                </a>
        <br />
            </td>
        </tr>

        <tr class="top-aligned-row">
            <td><strong>Parent:</strong></td>
            <td>
                <a href="../../Object.html">
                Object
               </a>
            </td>
        </tr>
        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">

    <div id="description">
      <p>
Abstract base class for AggregateReflection and AssociationReflection that
describes the interface available for both of those classes. Objects of
AggregateReflection and AssociationReflection are returned by the <a
href="ClassMethods.html">Reflection::ClassMethods</a>.
</p>

    </div>


   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M001325">==</a>&nbsp;&nbsp;
      <a href="#M001326">belongs_to?</a>&nbsp;&nbsp;
      <a href="#M001324">class_name</a>&nbsp;&nbsp;
      <a href="#M001323">klass</a>&nbsp;&nbsp;
      <a href="#M001321">macro</a>&nbsp;&nbsp;
      <a href="#M001320">name</a>&nbsp;&nbsp;
      <a href="#M001319">new</a>&nbsp;&nbsp;
      <a href="#M001322">options</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->

    <div id="section">





    <div id="attribute-list">
      <h3 class="section-bar">Attributes</h3>

      <div class="name-list">
        <table>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">active_record</td>
          <td class="context-item-value">&nbsp;[R]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        </table>
      </div>
    </div>
      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Class methods</h3>

      <div id="method-M001319" class="method-detail">
        <a name="M001319"></a>

        <div class="method-heading">
          <a href="#M001319" class="method-signature">
          <span class="method-name">new</span><span class="method-args">(macro, name, options, active_record)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001319-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001319-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/reflection.rb, line 76</span>
76:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">macro</span>, <span class="ruby-identifier">name</span>, <span class="ruby-identifier">options</span>, <span class="ruby-identifier">active_record</span>)
77:         <span class="ruby-ivar">@macro</span>, <span class="ruby-ivar">@name</span>, <span class="ruby-ivar">@options</span>, <span class="ruby-ivar">@active_record</span> = <span class="ruby-identifier">macro</span>, <span class="ruby-identifier">name</span>, <span class="ruby-identifier">options</span>, <span class="ruby-identifier">active_record</span>
78:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <h3 class="section-bar">Public Instance methods</h3>

      <div id="method-M001325" class="method-detail">
        <a name="M001325"></a>

        <div class="method-heading">
          <a href="#M001325" class="method-signature">
          <span class="method-name">==</span><span class="method-args">(other_aggregation)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Returns <tt>true</tt> if <tt>self</tt> and <tt>other_aggregation</tt> have
the same <tt><a href="MacroReflection.html#M001320">name</a></tt>
attribute, <tt>active_record</tt> attribute, and <tt>other_aggregation</tt>
has an <a href="MacroReflection.html#M001322">options</a> hash assigned to
it.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001325-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001325-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/reflection.rb, line 112</span>
112:       <span class="ruby-keyword kw">def</span> <span class="ruby-operator">==</span>(<span class="ruby-identifier">other_aggregation</span>)
113:         <span class="ruby-identifier">other_aggregation</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">name</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">other_aggregation</span>.<span class="ruby-identifier">name</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">other_aggregation</span>.<span class="ruby-identifier">options</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">active_record</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">other_aggregation</span>.<span class="ruby-identifier">active_record</span>
114:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001326" class="method-detail">
        <a name="M001326"></a>

        <div class="method-heading">
          <a href="#M001326" class="method-signature">
          <span class="method-name">belongs_to?</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Returns <tt>true</tt> if <tt>self</tt> is a <tt>belongs_to</tt> reflection.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001326-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001326-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/reflection.rb, line 121</span>
121:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">belongs_to?</span>
122:         <span class="ruby-identifier">macro</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:belongs_to</span>
123:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001324" class="method-detail">
        <a name="M001324"></a>

        <div class="method-heading">
          <a href="#M001324" class="method-signature">
          <span class="method-name">class_name</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Returns the class <a href="MacroReflection.html#M001320">name</a> for the
<a href="MacroReflection.html#M001321">macro</a>. For example,
<tt>composed_of :balance, :<a
href="MacroReflection.html#M001324">class_name</a> =&gt;
&#8216;Money&#8216;</tt> returns <tt>&#8216;Money&#8216;</tt> and
<tt>has_many :clients</tt> returns <tt>&#8216;Client&#8216;</tt>.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001324-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001324-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/reflection.rb, line 106</span>
106:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">class_name</span>
107:         <span class="ruby-ivar">@class_name</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:class_name</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">derive_class_name</span>
108:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001323" class="method-detail">
        <a name="M001323"></a>

        <div class="method-heading">
          <a href="#M001323" class="method-signature">
          <span class="method-name">klass</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Returns the class for the <a href="MacroReflection.html#M001321">macro</a>.
For example, <tt>composed_of :balance, :<a
href="MacroReflection.html#M001324">class_name</a> =&gt;
&#8216;Money&#8216;</tt> returns the Money class and <tt>has_many
:clients</tt> returns the Client class.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001323-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001323-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/reflection.rb, line 100</span>
100:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">klass</span>
101:         <span class="ruby-ivar">@klass</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">class_name</span>.<span class="ruby-identifier">constantize</span>
102:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001321" class="method-detail">
        <a name="M001321"></a>

        <div class="method-heading">
          <a href="#M001321" class="method-signature">
          <span class="method-name">macro</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Returns the <a href="MacroReflection.html#M001321">macro</a> type. For
example, <tt>composed_of :balance, :<a
href="MacroReflection.html#M001324">class_name</a> =&gt;
&#8216;Money&#8216;</tt> will return <tt>:composed_of</tt> or for
<tt>has_many :clients</tt> will return <tt>:has_many</tt>.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001321-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001321-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/reflection.rb, line 88</span>
88:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">macro</span>
89:         <span class="ruby-ivar">@macro</span>
90:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001320" class="method-detail">
        <a name="M001320"></a>

        <div class="method-heading">
          <a href="#M001320" class="method-signature">
          <span class="method-name">name</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Returns the <a href="MacroReflection.html#M001320">name</a> of the <a
href="MacroReflection.html#M001321">macro</a>. For example, <tt>composed_of
:balance, :<a href="MacroReflection.html#M001324">class_name</a> =&gt;
&#8216;Money&#8216;</tt> will return <tt>:balance</tt> or for <tt>has_many
:clients</tt> it will return <tt>:clients</tt>.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001320-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001320-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/reflection.rb, line 82</span>
82:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">name</span>
83:         <span class="ruby-ivar">@name</span>
84:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001322" class="method-detail">
        <a name="M001322"></a>

        <div class="method-heading">
          <a href="#M001322" class="method-signature">
          <span class="method-name">options</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Returns the hash of <a href="MacroReflection.html#M001322">options</a> used
for the <a href="MacroReflection.html#M001321">macro</a>. For example, it
would return <tt>{ :<a href="MacroReflection.html#M001324">class_name</a>
=&gt; &quot;Money&quot; }</tt> for <tt>composed_of :balance, :<a
href="MacroReflection.html#M001324">class_name</a> =&gt;
&#8216;Money&#8216;</tt> or +{}+ for <tt>has_many :clients</tt>.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001322-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001322-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/reflection.rb, line 94</span>
94:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">options</span>
95:         <span class="ruby-ivar">@options</span>
96:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>